<template>
  <div class="account_management">
    <c-title :hide="false" text="账户管理"></c-title>
    <div class="account_management_top">
      <div class="estimated_value">
        <span>资金及拍品预估价值</span>
        <div class="priceLine">
          <div class="small">{{ $i18n.t("money") }}</div>
          <div class="price">{{ infoData.sum_amount }}</div>
        </div>
      </div>
    </div>
    <div class="detail">
      <div class="grid">
        <span>{{ $i18n.t("money") }}{{ infoData.money }}</span>
        <span>账户金额</span>
      </div>
      <div class="grid">
        <span>{{ $i18n.t("money") }}{{ infoData.goods_amount }}</span>
        <span>预估价值</span>
      </div>
      <div class="grid">
        <span>{{ $i18n.t("money") }}{{ infoData.self_income }}</span>
        <span>盈利</span>
      </div>
      <div class="grid">
        <span>{{ $i18n.t("money") }}{{ infoData.parent_income }}</span>
        <span>收益</span>
      </div>
    </div>
    <div class="detail_grid">
      <van-grid :column-num="4">
        <van-grid-item v-for="(item, index) in btn" :key="index">
          <template #default>
            <div class="flex_c" @click="toUrlLink(item)">
              <i :class="item.icon"></i>
              <span>{{ item.txt }}</span>
            </div>
          </template>
        </van-grid-item>
      </van-grid>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      btn: [
        {
          icon: "iconfont icon-chongzhimingxi",
          txt: "充值",
          link: "new_auction_recharge"
        },
        {
          icon: "iconfont icon-tixian3",
          txt: "提现",
          link: "new_auction_withdraw"
        },
        {
          icon: "iconfont icon-zhangdanmingxi",
          txt: "账单明细",
          link: "new_auction_billing"
        },
        {
          icon: "iconfont icon-chongzhimingxi",
          txt: "充值明细",
          link: "new_auction_rechargeDetail"
        },
        {
          icon: "iconfont icon-canpaimingxi",
          txt: "参拍明细",
          link: "new_auction_Bidding_detail"
        },
        {
          icon: "iconfont icon-weipaimingxi",
          txt: "委拍明细",
          link: "new_auction_Auction_details"
        },
        {
          icon: "iconfont icon-shouyimingxi",
          txt: "收益明细",
          link: "new_auction_Income_detail"
        },
        {
          icon: "iconfont icon-yinglimingxi",
          txt: "盈利明细",
          link: "new_auction_Profit_detail"
        }
      ],
      infoData: []
    };
  },
  activated() {
    this.getData();
  },
  methods: {
    toUrlLink(item) {
      if (item.link == "new_auction_withdraw") {
        this.$router.push(this.fun.getUrl(item.link, { tag: "balance" }));
        return;
      }
      this.$router.push(this.fun.getUrl(item.link, {}));
    },
    async getData() {
      let { data, msg, result } = await $http.post("plugin.new-auction.frontend.index", {}, "");
      if (result) {
        this.infoData = data;
      } else {
        this.$toast(msg);
      }
    }
  }
};
</script>
<style lang="scss" scoped>
.detail_grid {
  margin: 0.63rem 0.75rem;
  border-radius: 0.5rem;
  overflow: hidden;
  .flex_c {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    i {
      font-size: 1.5rem;
      margin-bottom: 0.56rem;
    }
    span {
      font-size: 0.75rem;
      color: #00001c;
    }
  }
}
.detail {
  margin: 0 0.75rem;
  margin-top: -4rem;
  background: #ffffff;
  border-radius: 0.5rem;
  display: flex;
  padding: 1rem 0;
  .grid {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
  }
}
.account_management_top {
  height: 9.72rem;
  background: linear-gradient(180deg, #f15353 0%, #f5f5f5 100%);
  padding-top: 1.47rem;
  .estimated_value {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 0.81rem;
    color: #ffffff;
    .priceLine {
      display: flex;
      align-items: flex-end;
      margin-top: 0.44rem;
      .small {
        font-size: 0.9rem;
      }
      .price {
        font-size: 1.5rem;
        font-weight: bold;
        line-height: 1.5rem;
      }
    }
  }
}
</style>
